{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                        <div class="layui-col-md6 layui-input-inline">
                        <select name="apply_status" lay-search="" class="layui-input">
                            <option  value="">全部营收方式</option>
                            <option  value="1">已打款</option>
                            <option  value="2">未打款</option>
                        </select>
                    </div>
                    <div class="layui-col-md6 layui-input-inline">
                            <select name="apply_status" lay-search="" class="layui-input">
                                <option  value="">全部支付方式</option>
                                <option  value="1">支付宝</option>
                                <option  value="2">微信</option>
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" id="key" class="layui-input search" name="key" value="" placeholder="用户手机号码|用户名称"/>
                        </div>
                        <div class="layui-input-inline">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <div class="col-sm-12">
                    <div class="input-group" >
                        <button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">
                            <i class="fa fa-wrench"></i> 批量操作 <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">
                            <li><a  href="javascript:;" class="layuiBtn" data-type="usingAllS"><i class="fa fa-external-link"></i> 批量打款</a></li>
                        </ul>
                    </div>
                </div>
                <!--搜索框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <!--<script type="text/html" id="revenue_file_name">-->
                        <!--<img src="{{d.revenue_file_name}}" class="layui-table-img layui-cricle" onerror="this.src='/static/admin/images/head_default.gif'"/>-->
                    <!--</script>-->
                    <script type="text/html" id="apply_status">
                        {{# if(d.apply_status ==1){ }}
                        已打款
                        {{# } }}
                        {{# if(d.apply_status ==2){ }}
                        拒绝
                        {{# } }}
                        {{# if(d.apply_status ==3){ }}
                        未打款
                        {{# } }}
                    </script>
                    <script type="text/html" id="apply_type">
                        {{# if(d.apply_type ==1){ }}
                        支付宝
                        {{# } }}
                        {{# if(d.apply_type ==2){ }}
                        微信
                        {{# } }}
                    </script>
                    <script type="text/html" id="apply_active">
                        {{# if(d.apply_active ==1){ }}
                        普通任务提现
                        {{# } }}
                        {{# if(d.apply_active ==2){ }}
                        活动任务提现
                        {{# } }}
                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        {{# if(d.apply_status ==3){ }}
                        <a href="javascript:;" onclick="wk.href('{:url('money')}?id={{d.apply_id}}')" class="btn btn-primary btn-xs m-r-xs">打款</a>
                       {{# } }}
                        <a href="javascript:;" onclick="wk.excelAll('{{d.apply_id}}','{:url('excelIn')}','确认要导出吗?')" class="btn btn-primary btn-xs m-r-xs">导出</a>
                        <!--<a href="javascript:;" onclick="wk.confirm('{{d.revenue_id}}','{:url('excelIn')}','确定要隐藏轮播图吗?')" class="btn btn-warning btn-xs m-r-xs" title="隐藏"><i class="fa fa-toggle-off"></i></a>-->
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("cash/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type: 'checkbox', fixed: 'left',}
                , {type:'numbers', width: 70, title: '序号'}
                , {field: 'applt_time', width: 200, title: '申请时间', align: 'center'}
                , {field: 'apply_user_id', width: 200, title: '用户ID', align: 'center'}
                , {field: 'user_username', width: 200, title: '用户名称', align: 'center'}
                , {field: 'user_phone', width: 200, title: '用户账号', align: 'center'}
                , {field: 'apply_money', width: 150, title: '申请提现金额', align: 'center'}
                , {field: 'apply_get_money', width: 150, title: '实际金额(≈)', align: 'center'}
                , {field: 'apply_type', width: 200, title: '提现方式', align: 'center',templet:"#apply_type"}
                , {field: 'apply_account', width: 200, title: '提现账号', align: 'center'}
                , {field: 'apply_status', width: 200, title: '状态', align: 'center',templet:"#apply_status"}
                , {field: 'apply_active', width: 200, title: '提现类型', align: 'center',templet:"#apply_active"}
                , {field: 'apply_content', width: 200, title: '备注', align: 'center'}
                , {fixed: 'right', width:200, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('.layui-cricle').viewer();//图片查看器
            }
        });
        //监听状态开关操作
        form.on('switch(OnOff)', function (obj) {
            var num = '';
            obj.elem.checked == true? num = 1: num = 2;
            //用户状态
            wk.status(this.value,num, '{:url("memberState")}',obj);
        });

        //批量操作
        var $ = layui.$, active = {
            usingAllS: function(){
                //导出Excel
                wk.money(getIds(),"{:url('money')}");
            }
        };
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                    ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['apply_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>